<?php
/*
	我的下线
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
cfc('core')->checklogin();
$zhan_id=$this->getcolumn('member',array('mid'=>$_SESSION['uid']),'id');
if($_RQ['op']=='main'){
	$return['setting']=$this->plugin_setting('page');
	$return['member']=cfc('core')->member_show($_SESSION['uid']);
	$params=array('uniacid'=>$_SESSION['uniacid'],'fromuser'=>$_SESSION['uid']);
	$return['member']['merchnum']=pdo_count('jy_kuaidisys_member',$params,'id');
	$return['list']=array();
	set_html('title',$return['setting']['tmydown']?:'我的商户');
	exi($return);
}
if($_RQ['op']=='list'){
	$params=array('uniacid'=>$_SESSION['uniacid'],'fromuser'=>$_SESSION['uid']);
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_kuaidisys_member',$params,array($pindex,$psize),$total,$fields,'','createtime desc');
	if(!$list){
		exi('none');
	}
	foreach($list as &$item){
		$item['member']=cfc('core')->member_show($item['mid']);
		$item['jointime']=date('Y-m-d H:i:s',$item['createtime']);
		$item['moneycount']=pdo_getsum('jy_kuaidisys_jilog',array('ispay'=>1,'mid'=>$item['mid']),'money');
		$item['ordercount']=pdo_count('jy_kuaidisys_jilog',array('ispay'=>1,'mid'=>$item['mid']),'id');
	}
	$return['list']=$list;
	exi($return);
}
?>